const config = require('../config')
const { bech32 } = require('bech32');
const usdc = require('./usdc');
const tokenMessager = require('./TokenMessager')
const admin = require('./wallet');
const web3 = require('web3')
const {BigNumber} = require('ethers');
const run = async ()=>{
    // Noble destination address
    let nobleAddress = "noble1dfmfm0ak4yx72ec3qtf49pdyztg0jclgpfntvv";
    nobleAddress = "noble102rkzjw0p7a6t27ywsgggj2mjhzrarqlu66ys2";
    console.log("word: ", bech32.decode(nobleAddress).words)
    const mintRecipient = bech32.fromWords(bech32.decode(nobleAddress).words)
    console.log("mintRecipient: ", mintRecipient)

    // Amount that will be transferred
    const amount = 793409;
    const channel = 20; // dydx

    const mintRecipientBytes = new Uint8Array(32);
    mintRecipientBytes.set(mintRecipient, 32 - mintRecipient.length);
    const mintRecipientHex = web3.utils.bytesToHex(mintRecipientBytes)

    const ETH_TOKEN_MESSENGER_CONTRACT_ADDRESS = config.goerli.scAddr.ETH_TOKEN_MESSENGER_CONTRACT_ADDRESS;
    const USDC_ETH_CONTRACT_ADDRESS = config.goerli.scAddr.USDC_ETH_CONTRACT_ADDRESS;

    let rt = await tokenMessager.depositForBurn(admin, amount,4, mintRecipientHex, USDC_ETH_CONTRACT_ADDRESS);
    console.log('1 -- rt: ', rt)



}
run();